package com.aistar.service.impl;

import com.aistar.mapper.DishMapper;
import com.aistar.pojo.Dish;
import com.aistar.pojo.DishExample;
import com.aistar.service.DishService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DishServiceImpl implements DishService {
    @Autowired
    private DishMapper dishMapper;

    @Override
    public Dish getById(Integer id) {
        return dishMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Dish> getByShopId(Integer shopId) {

        DishExample dishExample =  new DishExample();
        DishExample.Criteria criteria = dishExample.createCriteria();
        criteria.andShopIdEqualTo(shopId);
        List<Dish> dishList = dishMapper.selectByExample(dishExample);
        return dishList;
    }
}
